﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MissionEditor.ConditionUI
{
    public partial class UnitInTile : UserControl, IConditionUI
    {
        Condition condition;
        public UnitInTile(Condition condition)
        {
            this.condition = condition;
            InitializeComponent();

            xTextBox.Text = BitConverter.ToUInt32(condition.raw, 12).ToString();
            yTextBox.Text = BitConverter.ToUInt32(condition.raw, 16).ToString();
            runCountTextBox.Text = BitConverter.ToUInt32(condition.raw, 8).ToString();
        }
        public void Apply()
        {
            BitConverter.GetBytes(Convert.ToUInt32(xTextBox.Text)).CopyTo(condition.raw, 12);
            BitConverter.GetBytes(Convert.ToUInt32(yTextBox.Text)).CopyTo(condition.raw, 16);
            BitConverter.GetBytes(Convert.ToUInt32(runCountTextBox.Text)).CopyTo(condition.raw, 8);
        }
    }
}
